<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
		<script type="text/javascript" src="./js/json2.js"></script>
		<script type="text/javascript" src="./js/jquery.js"></script>
    <script type="text/javascript" src="./js/xd-oauth-client.js"></script>
    <script type="text/javascript">
$(function() {
  $('#toggle').click(function() {
    var wrap = $('#xdProxyUrlWrap');
    wrap[wrap.is(":hidden") ? "show" : "hide"]();
  });
  $('#examples').append($.map([
    [ 'Google Calendar', 'http://www.google.com/calendar/feeds/private/default/full' ],
    [ 'Google Contacts', 'http://www.google.com/m8/feeds/contacts/default/full' ],
    [ 'Google Docs', 'http://docs.google.com/feeds/documents/private/full/' ],
    [ 'Google Spreadsheets', 'http://spreadsheets.google.com/feeds/spreadsheets/private/full' ],
    [ 'Google Base', 'http://www.google.com/base/feeds/items' ],
    [ 'Picasa', 'http://picasaweb.google.com/data/feed/api/user/default' ],
    [ 'Twitter', 'http://twitter.com/friends/ids.xml' ],
    [ 'Myspace', 'http://api.myspace.com/v1/user' ],
    [ 'Smart.fm', 'http://api.smart.fm/sessions' ]
  ], function(a) {
    return '<option value="'+a[1]+'">'+a[0]+'</option>';
  }).join('')).change(function() {
    $('#url').val($(this).val());
  });
  $('#submit').click(function() {
    XdOAuth.init($('#xdProxyUrl').val());
    XdOAuth.request({
      url : $('#url').val(),
      success : function(data, status) {
        $('#result').show().val(data);
      },
      error : function(res) { alert(res.body); }
    });
  });
});
    </script>
	</head>
	<body>
    <img src="./img/s.gif" /><br/>
    OAuth API URL :
    <input type="text" size="100" id="url" name="url" value="http://www.google.com/calendar/feeds/default/private/full"><br/>
    Examples : 
    <select id="examples"></select>
    <br/>
    <div>
    <a href="#" id="toggle">Set OAuth XD proxy server URL</a>
    </div>
    <div id="xdProxyUrlWrap" style="display:none">
    <input type="text" size="100" id="xdProxyUrl" name="xdProxyUrl" value="http://xdoauthproxy.appspot.com/xd-server.html">
    </div>
    <input type="button" id="submit" value="Submit">
    <hr/>
    <textarea id="result" style="display:none;font-size:10px;width:600px;height:400px"></textarea>
	</body>
</html>

